﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ImageCompressor
{
    /// <summary>
    /// 一张照片的打开路径和储存路径
    /// </summary>
    class ImgPaths
    {
        public bool KeepOriginal { get; set; } = true;
        public FileInfo ReadFileInfo { get; private set; }
        FileInfo saveInfo;
        public FileInfo SaveFileInfo
        {
            get
            {
                if(KeepOriginal)
                {
                    return saveInfo;
                }
                else
                {
                    return ReadFileInfo;
                }
            }
        }
        public ImgPaths(string readPath, string writePath) 
        {
            ReadFileInfo = new FileInfo(readPath);
            string extension = Path.GetExtension(writePath).ToLower();
            if(extension != ".jpg" || extension !=".jpeg")
            {
                Path.ChangeExtension(writePath, ".jpg");
            }
            this.saveInfo = new FileInfo(writePath);
        }

    }
}
